<?php 
	if($_POST['submit']){
		$f1 = $_POST['username'];
		$f2 = $_POST['password'];
		$f3 = $_POST['email'];
		$f4 = $_POST['phone'];
		$f5 = $_POST['yanzhengma'];//暂时还没用到
		
		if($f1==''){
			$result_info = '用户名不能为空';
		}else if($f2==''){
			$result_info = '密码不能为空';
		}
		if(!$result_info){
			require_once("./includes/configure.php");
			require_once("./includes/database.php");
			$db = Database::Connect();  
			$sql = "SELECT * FROM ask_user WHERE username='".$db->Encode($f1)."'";
			   
		    $row = $db->GetSingleRow($sql);
		    if(!$row)  
		    {
		    	//可以注册
				$sql = "
					INSERT INTO `ask_user` VALUES (null, '".$db->Encode($f1)."', '".md5($f2)."', '".$db->Encode($f3)."', '', 7, 0, 20, 20, '', 0, 0, '0000-0-0', '".$db->Encode($f4)."', '', '', '', '', 0, 0, 0, 7, 0)
					";
				$db->Execute($sql);
		    	$result_info ="注册完成。&nbsp;<a href='login.php'>登陆</a>";
		    }else{
				$result_info ="已经存在用户:".$f1;
		    }
		    $db->Close(); 	
		}
	}
?>
<div id="content">
<div class="member_cont">
<div id="regMainContainer">
<div id="caption">
<table cellpadding="0" cellspacing="0" border="0">
	<tbody>
		<tr>
			<td valign="top">普通用户快速注册</td>
		</tr>
	</tbody>
</table>
</div>
<style>
.reg_div p{
	margin-top: 3px;
}
.reg_div p .my_register_submit_new{
	margin-left: 90px;
    margin-top: 10px;
}
.reg_div span{
	display:block;
	width:90px;
	float:left;
	font-size:14px;
	text-align: right;
	padding-top: 3px;
}
</style>
<form id="reg_form" name="reg_form"
	action="" method="post">
<div style="padding-top:10px;padding-left:120px;" class="reg_div">
	<p style="color: gray;    font-size: larger;    font-weight: bold;    padding-bottom: 20px;    padding-left: 17px;"><?php echo $result_info;?></p>
	<p><span>* 用户名：</span><input class="inputname" type="text" name="username" size="20"
				id="username" maxlength="16" value=""></p>
	<p><span>* 密码：</span><input class="inputpwd" type="password" name="password" size="20"
				id="password" maxlength="16" value=""></p>
	<p><span>邮箱：</span><input class="inputname"  type="text" name="email" size="25" id="email" value=""></p>
	<p><span>手机号码：</span><input class="inputname" type="text" name="phone" size="20"
				id="phone" maxlength="16" value="">
				<INPUT type="radio" name="is_public" value="1">公开
				<INPUT type="radio" name="is_public" value="0" checked>不公开
	</p>
	<p style="color:gray;">
		<span>手机验证码：</span>
		<input class="inputname" type="text" name="yanzhengma"
				size="20" maxlength="16" value="">
		<input type="button" name="get_yanzhengma" size="20" 
				maxlength="16" value="点击获取">
	</p>
	<p><input class="my_register_submit_new" value=""
			type="submit" name="my_register_submit">
	   <input type="hidden" name="submit" value="提交注册"></p>
</div>
</form>
</div>
<div id="regSideContainer">
<dl class="tips">
	<dt>注册房客网您可以：</dt>
	<dd>网上找房买房，轻松操作</dd>
	<dd>定制找房条件，自动匹配</dd>
	<dd>房价即时变化，一手掌握</dd>
	<dd>小区新鲜房源，一网打尽</dd>
	<dd>业主委托卖房，简单快捷</dd>
</dl>
<div class="title">&gt; <a href="./login.php">我已注册，马上登录</a></div>
</div>
</div>
</div>
